package edu.nuist.javaProjct.dao;

import edu.nuist.javaProjct.config.JdbcUtils;
import org.springframework.jdbc.core.JdbcTemplate;

public class UserBasicDao {

    private static final JdbcTemplate template = new JdbcTemplate(JdbcUtils.getDataSource());


    /**
     * 登录查询
     * @param username 用户名
     * @param password 密码
     * @return 是否认证成功
     */
    public boolean queryUserAuth(String username,String password){
        String sql="SELECT COUNT(*) FROM userdatasource WHERE username=? AND password=?";
        int queryResult=template.queryForObject(sql,Integer.class,username,password);
        return queryResult==1;
    }

}
